home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
011
/
stuffit.arc
/
MAIN.ASM
< prev
next >
Wrap
Assembly Source File
|
1985-11-18
|
4KB
|
130 lines
PAGE 78,132 ; (CTRL-OH) 0 IBM PC PRINTER 8 LPI, CONDENSED MOD
title STUFIT - Disk file stuffer routine
CSEG SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:CSEG,DS:CSEG,SS:CSEG,ES:CSEG ;ALREADY SET BY DOS LOADER
ORG 100H ;Skip to the end of the PSP
ENTRY: JMP START ;COM file entry always at 100H
;----------------------------------------------------------
; include files
include pspequ.asm
include errmsg.asm
include chkdos.asm
include avail.asm
include getdpf.asm
include getfirst.asm
include getflen.asm
include needlen.asm
include dumfile.asm
include cpyfile.asm
include delfile.asm
include renfile.asm
;----------------------------------------------------------
; constants and messages
cr equ 0dh ;carriage return
lf equ 0ah ;line feed
eos equ '$' ;end of string character
ego db 'V0.6, 6.13.85 Zider Brothers, San Francisco',cr,lf,eos
egoln db $-ego-1
nl db cr,lf,eos
tfile db 'zz.bot',0
tfile2 db 'zz.top',0
dumfname db 'gobbige.zzz',0 ;default dummy file name
;----------------------------------------------------------
; data storage
;----------------------------------------------------------
; subroutines
filecopy:
mov cx,bufsiz ;transfer buffer size
mov dx,offset buf ;transfer buffer address
;SI has source file address
;DI has dest file address
call cpyfile
ret
;----------------------------------------------------------
; main code
START PROC NEAR
call chkdos ;check for version 2.x+
jc finis ;error if carry set
call avail ;get disk space available
jc finis ;error msg call from subroutine
call getdpathfname ;get file name
jc finis ;if carry set--error
call getfirst ;get first file
jc finis ;etc.
nextfile:
;---- copy file to low disk to make more room
;---- code skipped here (commented out)
; mov si,offset dpathfilenm
; mov di,offset tfile
; call filecopy ;copy to lowest available
; jc finis
; mov dx,offset dpathfilenm
; call delfile
; jc finis
; mov dx,offset tfile
; mov di,offset dpathfilenm
; call renfile
; jc finis
;---- main file stuff
mov dx,offset dpathfilenm
call getflen ;get file length
jc finis
call needlen ;compute needed dummy file length
jc finis
mov dx,offset dumfname ;ASCIIZ string of dummy file
call dumfile ;make dummy file
jc finis
cli ;disable all maskable int's
mov si,offset dpathfilenm
mov di,offset tfile2 ;temp file name
call filecopy ;copy file to temp
jc finis
mov dx,offset dpathfilenm
call delfile ;delete original file
jc finis
mov dx,offset dumfname ;del 'GOBBIGE.ZZZ'
call delfile
jc finis
mov dx,offset tfile2
mov di,offset dpathfilenm
call renfile ;rename temp file to orig name
jc finis
sti ;interrupts back on
call getnext ;get next matching file
jc finis
jmp nextfile
finis:
sti ;re-enable all int's
RET
START ENDP
;----------------------------------------------------------
; buffers
endprog equ $
bufsiz equ 8000H ;32KB read/write buffer
buf equ $
CSEG ENDS
END ENTRY